import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApplyJobVO, ApplyJobForm, ApplyJobQuery, InitBossForm } from '@/api/boss/applyJob/types';

/**
 * 查询沟通任务列表
 * @param query
 * @returns {*}
 */

export const listApplyJob = (query ?: ApplyJobQuery) : AxiosPromise<ApplyJobVO[]> => {
  return request({
    url: '/boss/applyJob/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询沟通任务详细
 * @param applyJobId
 */
export const getApplyJob = (applyJobId : string | number) : AxiosPromise<ApplyJobVO> => {
  return request({
    url: '/boss/applyJob/' + applyJobId,
    method: 'get'
  });
};

/**
 * 新增沟通任务
 * @param data
 */
export const addApplyJob = (data : ApplyJobForm) => {
  return request({
    url: '/boss/applyJob',
    method: 'post',
    data: data
  });
};

/**
 * 修改沟通任务
 * @param data
 */
export const updateApplyJob = (data : ApplyJobForm) => {
  return request({
    url: '/boss/applyJob',
    method: 'put',
    data: data
  });
};

/**
 * 删除沟通任务
 * @param applyJobId
 */
export const delApplyJob = (applyJobId : string | number | Array<string | number>) => {
  return request({
    url: '/boss/applyJob/' + applyJobId,
    method: 'delete'
  });
};

/**
 * 初始化boss
 * @param data
 */
export const initBoss = (data : InitBossForm) => {
  return request({
    url: '/boss/init',
    method: 'post',
    data: data
  });
};
